<template>
	<view>
		<view class="ml30 radius16 bac_f mr30 dis_flex mt26 pl24" style="height: 136rpx;" v-for="(item, index) in store_list" :key="index" @click="busClick(item)">
			<view class="tf32 fw ">{{ item.name }}</view>
			<view class="w40 h40 radius501 border1" style="margin-right: 34rpx;" :class="{ active: cur_id == item.id }"></view>
		</view>
	</view>
</template>

<script>
import { storeList } from '@/config/api.js';
export default {
	data() {
		return {
			chst: 0,
			store_list: [],
			cur_id: ''
		};
	},
	onLoad() {
		this.getStoreList();
	},
	methods: {
		//获取店铺列表
		busClick(item) {
			this.cur_id = item.id;
			uni.navigateBack({
						delta: 1,//写几就是往前面返回几个页面，
						success:()=>{
							this.getOpenerEventChannel().emit('data',item)//返回上一页把C更改的值回传给A页面
						}
					})
      
		},
		getStoreList() {
			storeList().then(res => {
				this.store_list = res;
			});
		}
	}
};
</script>

<style lang="scss" scoped>
.active {
	background-image: url(@/static/image/xuanzhong.png);
	background-size: cover;
	border: none;
}
</style>
